package com.ironman.analyze.core.handler;

import lombok.Getter;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

@Getter
public abstract class BasePostHandler<T> {

    private final AtomicInteger counter = new AtomicInteger(0);


    public abstract void handler(T data, Consumer<T> consumer);

    /**
     * 模板处理
     */
    public void doHandler(T data, Consumer<T> consumer) {
        threshold(data);
        consumer.accept(data);
    }

    /**
     * 阈值判断
     */
    public void threshold(T data){}

}
